package com.ysu.demo.config;

import com.ysu.demo.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author ：lhw
 * @date ：Created in 2019/9/8 11:12
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(checklogin()).addPathPatterns("/**");
    }

    @Bean
    public LoginInterceptor checklogin(){
        return new LoginInterceptor();
    }

}
